/**
 * 这里是uni-app内置的常用样式变量
 *
 * uni-app 官方扩展插件及插件市场（https://ext.dcloud.net.cn）上很多三方插件均使用了这些样式变量
 * 如果你是插件开发者，建议你使用scss预处理，并在插件代码中直接使用这些变量（无需 import 这个文件），方便用户通过搭积木的方式开发整体风格一致的App
 *
 */

/**
 * 如果你是App开发者（插件使用者），你可以通过修改这些变量来定制自己的插件主题，实现自定义主题功能
 *
 * 如果你的项目同样使用了scss预处理，你也可以直接在你的 scss 代码中使用如下变量，同时无需 import 这个文件
 */

/* 颜色变量 */
$uni-primary: #ff0000;
$uni-success: #4cd964;
$uni-warning: #f0ad4e;
$uni-error: #dd524d;

/* 文字基本颜色 */
$uni-text-color: #333;
$uni-text-color-inverse: #fff;
$uni-text-color-grey: #999;
$uni-text-color-placeholder: #808080;
$uni-text-color-disable: #c0c0c0;

/* 背景颜色 */
$uni-bg-color: #f5f5f5;
$uni-bg-color-white: #fff;

/* 边框颜色 */
$uni-border-color: #e5e5e5;

/* 尺寸变量 */
$uni-spacing-row-sm: 10px;
$uni-spacing-row-base: 15px;
$uni-spacing-row-lg: 20px;
$uni-spacing-row-xl: 30px;

$uni-spacing-col-sm: 8px;
$uni-spacing-col-base: 12px;
$uni-spacing-col-lg: 16px;
$uni-spacing-col-xl: 24px;

/* 字体大小 */
$uni-font-size-sm: 24rpx;
$uni-font-size-base: 28rpx;
$uni-font-size-lg: 32rpx;
$uni-font-size-xl: 36rpx;

/* 图片大小 */
$uni-img-size-sm: 40rpx;
$uni-img-size-base: 52rpx;
$uni-img-size-lg: 80rpx;

/* 边框圆角 */
$uni-border-radius-sm: 4rpx;
$uni-border-radius-base: 6rpx;
$uni-border-radius-lg: 12rpx;
$uni-border-radius-circle: 50%;

/* 水平间距 */
$uni-spacing-row-sm: 10px;
$uni-spacing-row-base: 15px;
$uni-spacing-row-lg: 20px;
$uni-spacing-row-xl: 30px;

/* 垂直间距 */
$uni-spacing-col-sm: 8px;
$uni-spacing-col-base: 12px;
$uni-spacing-col-lg: 16px;
$uni-spacing-col-xl: 24px;

/* 阴影 */
$uni-shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.1);
$uni-shadow-base: 0 4px 8px rgba(0, 0, 0, 0.1);
$uni-shadow-lg: 0 8px 16px rgba(0, 0, 0, 0.1);

/* 渐变 */
$uni-gradient-primary: linear-gradient(to right, #ff0000, #ff6b6b);
$uni-gradient-success: linear-gradient(to right, #4cd964, #5cb85c);
$uni-gradient-warning: linear-gradient(to right, #f0ad4e, #f5b041);
$uni-gradient-error: linear-gradient(to right, #dd524d, #e74c3c);

/* 动画 */
$uni-animation-duration-fast: 0.2s;
$uni-animation-duration-base: 0.3s;
$uni-animation-duration-slow: 0.4s;

/* 混合器 */
@mixin flex-center {
  display: flex;
  align-items: center;
  justify-content: center;
}

@mixin flex-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

@mixin text-ellipsis {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@mixin multi-ellipsis($line: 2) {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: $line;
  overflow: hidden;
}

@mixin clearfix {
  &::after {
    content: '';
    display: table;
    clear: both;
  }
}

/* 全局样式 */
page {
  background-color: $uni-bg-color;
  font-size: $uni-font-size-base;
  color: $uni-text-color;
  line-height: 1.5;
}

/* 按钮样式 */
.btn {
  display: inline-block;
  padding: 0 30rpx;
  height: 80rpx;
  line-height: 80rpx;
  text-align: center;
  border-radius: 40rpx;
  font-size: $uni-font-size-base;
  
  &-primary {
    background: $uni-primary;
    color: $uni-text-color-inverse;
  }
  
  &-success {
    background: $uni-success;
    color: $uni-text-color-inverse;
  }
  
  &-warning {
    background: $uni-warning;
    color: $uni-text-color-inverse;
  }
  
  &-error {
    background: $uni-error;
    color: $uni-text-color-inverse;
  }
  
  &-plain {
    background: transparent;
    border: 2rpx solid currentColor;
  }
}

/* 卡片样式 */
.card {
  background: $uni-bg-color-white;
  border-radius: $uni-border-radius-base;
  padding: $uni-spacing-row-base;
  margin-bottom: $uni-spacing-row-base;
  box-shadow: $uni-shadow-sm;
}

/* 列表样式 */
.list {
  background: $uni-bg-color-white;
  
  &-item {
    display: flex;
    align-items: center;
    padding: $uni-spacing-row-base;
    border-bottom: 2rpx solid $uni-border-color;
    
    &:last-child {
      border-bottom: none;
    }
  }
}

/* 标签样式 */
.tag {
  display: inline-block;
  padding: 4rpx 12rpx;
  border-radius: $uni-border-radius-sm;
  font-size: $uni-font-size-sm;
  
  &-primary {
    background: rgba($uni-primary, 0.1);
    color: $uni-primary;
  }
  
  &-success {
    background: rgba($uni-success, 0.1);
    color: $uni-success;
  }
  
  &-warning {
    background: rgba($uni-warning, 0.1);
    color: $uni-warning;
  }
  
  &-error {
    background: rgba($uni-error, 0.1);
    color: $uni-error;
  }
}

/* 图标样式 */
.iconfont {
  font-family: "iconfont" !important;
  font-size: $uni-font-size-base;
  font-style: normal;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* 动画类 */
.fade-enter-active,
.fade-leave-active {
  transition: opacity $uni-animation-duration-base;
}

.fade-enter,
.fade-leave-to {
  opacity: 0;
}

.slide-up-enter-active,
.slide-up-leave-active {
  transition: transform $uni-animation-duration-base;
}

.slide-up-enter,
.slide-up-leave-to {
  transform: translateY(100%);
}

.slide-down-enter-active,
.slide-down-leave-active {
  transition: transform $uni-animation-duration-base;
}

.slide-down-enter,
.slide-down-leave-to {
  transform: translateY(-100%);
}
